package com.codeduck.kafka.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.TimeUnit;

/**
 * @author: <a href="mailto:codeduck@163.com">Codeduck</a>
 * @date: 2023/5/3
 */
public abstract class AbstractConsumerThread {

    private static final Logger LOGGER = LoggerFactory.getLogger(AbstractConsumerThread.class);

    abstract void start();

    protected void reStart() {
        try {
            TimeUnit.SECONDS.sleep(10L);
        } catch (InterruptedException e) {
            LOGGER.error("重启线程出现中断异常", e);
        }
        this.start();
    }
}
